package edu.cn.wj.cloud.controller;

import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class IndexController {

	@RequestMapping(value= {"/index","/"},method=RequestMethod.GET)
	public String index() {
		String name = SecurityContextHolder.getContext().getAuthentication().getName();
		System.out.println("LoginUser: "+name);
		return "Hello Security!";
	}
	
	@RequestMapping(value="/login")
	public String login() {
		System.out.println("login cas...");
		return "Hello Login!";
	}
	
	@RequestMapping(value="/logout")
	public String logout() {
		System.out.println("logout cas...");
		return "Hello logout!";
	}
	
	@RequestMapping(value="/logoutSucc")
	public String wLogout() {
		return "Hello Logout Success!";
	}
	
	
	@RequestMapping(value="/validate")
	public String validate() {
		System.out.println("validate..");
		return "Hello validate!";
	}
}
